
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author sempere
 */
public class towers {


        InputStreamReader arxiu;
        Integer tablero[][];
        Integer restriccions[][];
        Integer dimensio;

        public boolean carrega(String ruta) throws FileNotFoundException, UnsupportedEncodingException {
            arxiu = new InputStreamReader(new FileInputStream(ruta), "UTF-8");
            return (arxiu != null);
        }

        public String llig() throws IOException {
            String linea = "";
            int c = 0;

            c = arxiu.read();
            while ((char) c != '\n' && c > 0) {
                if (c < 256) {
                    linea += (char) c;

                }
                c = arxiu.read();
            }
            return linea;
        }

        public void Main(String[] args) throws IOException{
            extrauInformacio();

            
        }

    private void extrauInformacio() throws IOException {
       String token[];
       String linia= llig();

       dimensio = Integer.parseInt(linia);
       tablero = new Integer[dimensio][dimensio];
       for(int i=0; i< dimensio; i++){
           linia = llig();
           token = linia.split("\\s");
           for(int j=0; j<token.length; j++){
               tablero[i][j] = Integer.parseInt(token[j]);
           }

       }
       restriccions = new Integer[4][dimensio];
       linia = llig();
       token = linia.split("\\s");
        for(int i=0; i< 4; i++){
           linia = llig();
           token = linia.split("\\s");
           for(int j=0; j<token.length; j++){
               restriccions[i][j] = Integer.parseInt(token[j]);
           }
       }

       System.out.println("Èxit");
    }

}
